package com.visikard.widget;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.LinearLayout;

import com.visikard.ui.R;

public class ShadowOnLeftLinearLayout extends LinearLayout{

	private Bitmap _shadowBmp = null;
	private Rect _shadowBounds = new Rect();
	
	public ShadowOnLeftLinearLayout(Context context) {
		super(context);		
	}
	
	public ShadowOnLeftLinearLayout(Context context, AttributeSet attrSet) {
		super(context, attrSet);		
	}
	
	@Override
	protected void dispatchDraw(Canvas canvas){
		super.dispatchDraw(canvas);
		
		if(_shadowBmp == null)
			_shadowBmp = BitmapFactory.decodeResource(getResources(), R.drawable.act_swip_bg_shadow_left);
		
		_shadowBounds.left = 0;
		_shadowBounds.top = 0;
		_shadowBounds.right = getMeasuredWidth()/10;
		_shadowBounds.bottom = getMeasuredHeight();
		canvas.drawBitmap(_shadowBmp, null, _shadowBounds, null);
	}

}
